import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt(),k = in.nextInt();
        long[][] arr = new long[n][2];
        for (int i = 0; i < n; i++) {
            arr[i][0] = in.nextLong();
        }
        for (int i = 0; i < n; i++) {
            arr[i][1] = in.nextLong();
        }
        Arrays.sort(arr, new Comparator<long[]>() {
            @Override
            public int compare(long[] o1, long[] o2) {
                long dif1 = o1[1] - o1[0];
                long dif2 = o2[1] - o2[0];
                if(dif1 != dif2){
                    return Long.compare(dif2,dif1);
                }else {
                    return Long.compare(o1[0],o2[0]);
                }
            }
        });
        long totalAcid = 0;
        long totalSweet = 0;
        for (int i = 0; i < k; i++) {
            totalAcid += arr[i][0];
            totalSweet += arr[i][1];
        }
        System.out.println(totalAcid + " " + totalSweet);
    }

}